package com.hlz.mid.mq.producer.ttl;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 消费者代码
 *
 * @author Hongliang Zhu
 * @create 2022-11-30 21:34
 */
@Component
public class DeadLetterQueueConsumer {

    @RabbitListener(queues = "QD")
    public void receiveD(Message message, Channel channel) {
        String msg = new String(message.getBody());
        System.out.println("当前时间：" + new Date().toString() + ", 收到死信队列消息：" + msg);
    }
}
